/**
 * 
 */
package com.ztesoft.web.baseconfig.service;

import java.util.List;

import com.ztesoft.core.common.Page;
import com.ztesoft.framework.exception.BaseAppException;
import com.ztesoft.web.baseconfig.db.po.DmPlanPO;
import com.ztesoft.web.baseconfig.db.po.DmSrcTablePO;
import com.ztesoft.web.baseconfig.db.po.DmStrategyPO;
import com.ztesoft.web.baseconfig.db.po.StrategyNodePO;

/**
 * <Description> <br>
 * 
 * @author codeCreater<br>
 * @version 1.0<br>
 * @taskId <br>
 * @CreateDate 2014年11月11日 <br>
 * @since V1.0<br>
 * @see com.ztesoft.web.baseconfig.service <br>
 */

public interface IDmStrategyService {

	DmStrategyPO selectByPrimaryKey(Integer key) throws BaseAppException;

	/**
	 * 获取有关策略的所有信息，包括源数据、目标数据等
	 * 
	 * @param dmStrategyId
	 * @return
	 * @throws BaseAppException
	 */
	DmStrategyPO getStrategyAllInfo(Integer key) throws BaseAppException;

	/**
	 * 保存一个策略下的部分信息，包括：计划策略关系、策略、策略数据关系、源数据
	 * 
	 * @param dstPO
	 * @param state
	 *            :00A、0DA、00D
	 * @return
	 * @throws BaseAppException
	 * @throws Exception
	 */
	DmStrategyPO addSomeInfoOfOneStrategy(DmSrcTablePO dstPO, String state) throws BaseAppException, Exception;

	List<DmStrategyPO> selectByArg(DmStrategyPO record) throws BaseAppException;

	List<DmStrategyPO> selectByPlanId(Integer dmPlanId) throws BaseAppException;

	StrategyNodePO[] selectAllForTree(DmStrategyPO record) throws BaseAppException;

	Page<DmStrategyPO> selectByArgAndPage(DmStrategyPO record, Page<DmStrategyPO> resultPage) throws BaseAppException;

	/**
	 * 保存到草稿箱：保证计划名称不同 1、用户新增计划的中途，保存草稿 2、草稿箱列表，编辑
	 * 
	 * @param record
	 * @return 0：存在相同名称的计划，不可以保存草稿
	 * @throws BaseAppException
	 */
	int addForDraft(DmStrategyPO record) throws BaseAppException;

	/**
	 * 新增提交，保证策略名称不同
	 * 
	 * @param record
	 * @return 0:状态为00X，返回报错;1:存在相同名称的策略，不可以新增;
	 * @throws BaseAppException
	 */
	DmStrategyPO add(DmStrategyPO record) throws BaseAppException;

	/**
	 * 添加策略组，主要是为了获取策略组号、策略组名称、计划ID
	 * 
	 * @return
	 * @throws BaseAppException
	 */
	DmStrategyPO addStrategyGroup(DmPlanPO dpPO) throws BaseAppException;

	int update(DmStrategyPO record) throws BaseAppException;

	int delete(DmStrategyPO record) throws BaseAppException;

	int drag(Integer moveId, Integer targetId, String moveType) throws BaseAppException;

}
